<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
  <head>
    <title>房间信息查询</title>
	<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/js/common.js"></script>
	<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/js/page.js"></script>
	<script type="text/javascript" language="javascript" src="<%=request.getContextPath()%>/js/calendar/WdatePicker.js"></script>
  </head>
  <body>
  	<div align="center">
	    <form id="form" name="form" action="${pageContext.request.contextPath}/room/room!list.action" method="post">
	    	<table border="0" cellpadding="0" width="60%" align="center">
	    		<tr><td colspan="6" align="right"><a href="room_add.jsp" target="_target">新增</a></td></tr>
	    		<tr><!--   onClick="WdatePicker()"  -->
	    			<td width="20%">房屋描述:</td><td align="left"><input name="room.roomName" type="text" id="room.roomName" value="${room.roomName}"/></td>
	    			<td width="20%">出租金额:</td><td align="left"><input name="room.rentPrice" type="text" id="room.rentPrice" value="${room.rentPrice}"/></td>
	    			<td width="20%">房屋面积:</td><td align="left"><input name="room.roomSize" type="text" id="room.roomSize" value="${room.roomSize}"/></td>
	    		</tr>
	    		<tr>
	    			<td width="20%">楼层:</td><td align="left"><input name="room.floor" type="text" id="room.floor" value="${room.floor}"/></td>
	    			<td width="20%">房间号:</td><td align="left"><input name="room.roomNum" type="text" id="room.roomNum" value="${room.roomNum}"/></td>
	    			<td width="20%">户型:</td><td align="left"><input name="room.roomType" type="text" id="room.roomType" value="${room.roomType}"/></td>
	    		</tr>
	    		<tr><td colspan="6" align="center">
	    			<input type="hidden" name="room.curentPage" id="curentPage" value="${page.curentPage}">
	    			<input name="submit1" type="button"  onclick="queryForm();" value="查询"/>
	    		</td>
	    		</tr>
			</table>				
	    </form>
	    
	    
	    <table align="center" width="80%" border="0">
	    	<tr>
	    	  <td>
	    		<table align="center" width="100%" border="1">
		    		<tr>
			    		<td>房屋ID</td><td>房屋描述</td><td>出租金额</td><td>房屋面积</td>
			    		<td>楼层</td><td>房间号</td><td>户型</td><td>阳台个数</td>
			    		<td>修改</td><td>删除</td><td>详情</td>
			    	</tr>
		
			    	<s:iterator value="page.pageList" id="bean">
			    	<tr>
			    		<td>${bean.roomId}</td><td>${bean.roomName}</td><td>${bean.rentPrice}</td><td>${bean.roomSize}</td>
			    		<td>${bean.floor}</td><td>${bean.roomNum}</td><td>${bean.roomType}</td><td>${bean.balconyNum}</td>
			    		<td><a href="#" onclick="rendToUpdate('${bean.roomId}');">${bean.roomId}</a></td>
			    		<td><a href="#" onclick="rendToDelete('${bean.roomId}');">${bean.roomId}</a></td>
			    		<td><a href="#" onclick="rendToDetail('${bean.roomId}');">${bean.roomId}</a></td>
			    	</tr>
			    	</s:iterator>
	    		</table>
	    	  </td>
	    	</tr>
	    	<tr>
	    		<td><%@ include file="/common/page.jsp"%></td>
	    	</tr>
	    </table>
	   
    </div>
  </body>
  
  <script type="text/javascript">
  	function rendToDelete(roomId){
  		if (confirm("确认要删除此条数据吗？")) {
  			window.location="<%=request.getContextPath() %>/room/room!delete.action?room.roomId="+roomId;
        }
        return ;
  	}

  	function rendToUpdate(roomId){
  		 window.open("<%=request.getContextPath() %>/room/room!query.action?roomId=" + roomId, "_blank", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=300,height=260,left=300,top=300');
  	}

  	function rendToDetail(roomId){
  		 window.open("<%=request.getContextPath() %>/room/room!detail.action?roomId=" + roomId, "_blank", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=300,height=260,left=300,top=300');
 	}

	function queryForm(){
		var form=document.getElementById("form");
		document.getElementById("curentPage").value=0;
 	 	form.submit();
	}
  </script>
</html>
